[My github link] https://github.com/sydneydlu98/DSI_Data_Challenge_4

## load all the libraries
library(dplyr)
library(ggplot2)
library(plotly)
library(shiny)
library(rsconnect)
library(readr)
library(medicaldata)

View(strep_tb)
# clean data with improved patients
strep_imp <- strep_tb %>%
  filter(improved == "TRUE") %>%
  select(-dose_PAS_g)

# first plot - table
fig1 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Control/Case</b>", "<b>radiologic_6m</b>"),
    align = c("center", "center"),
    line = list(width = 1, color = 'black'),
    fill = list(color = c("grey", "grey")),
    font = list(
      family = "Arial",
      size = 14,
      color = "white"
    )
  ),
  cells = list(
    values = rbind(t(as.matrix(
      unname(strep_imp$arm)
    )),
    c(as.matrix(
      unname(strep_imp$radiologic_6m)
    ))),
    align = c("center", "center"),
    line = list(color = "black", width = 1),
    font = list(
      family = "Arial",
      size = 12,
      color = c("black")
    )
  )
)

fig1
# second plot - bar chart
p2 <- ggplot(data = strep_imp,
             aes(x = radiologic_6m, fill = arm)) +
  geom_bar()

fig2 <- ggplotly(p2)
fig2
# third plot - scatter plot
p3 <- ggplot(data = strep_imp,
             aes(x = baseline_condition, fill = arm)) +
  geom_bar()

fig3 <- ggplotly(p3)
fig3